Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BTreeSet for scopes #123

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

friendlymatthew
Copy link
Member

Since BTreeSet supports String keys, it's more efficient* to use a data structure without a hash step.

I'd imagine we'd want to do the same with key combinations.





* untested claim

Copy link
Collaborator

@mondeja mondeja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is not clear if would be more performant. The biggest gain here would be to define the HashSet as a HashSet<&'static str> instead of a HashSet<String> when possible (for literals), so the hashes probably are produced at compile time.

As contexts are created in a compile-time macro, it's possible to sometimes do that.

Note that BTrees are slower on lookup. Without a proper bench I don't know if this change it's worth.

@friendlymatthew
Copy link
Member Author

Without a proper bench I don't know if this change it's worth.

+1. Going to profile!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants